<template>
  <div id="userTeamJoinPage">
    <van-search v-model="searchText" placeholder="根据关键字搜索队伍" @search="onSearch(searchText)"/>
    <TeamCardList :team-list="teamList"/>
    <van-empty description="暂无查询数据" v-if="teamList.length===0"/>
  </div>

</template>

<script setup lang="ts">

import {useRouter} from "vue-router";
import TeamCardList from "../components/TeamCardList.vue";
import {onMounted, ref} from "vue";
import {listTeam} from "../services/user";
const router = useRouter();


//响应数据
const teamList=ref([])

//初始化队伍列表
onMounted( ()=>{
  listTeam('',teamList)
}
)

//搜索队伍关键字
const searchText=ref('')

const onSearch= (val)=>{
 listTeam(val,teamList)
}

// //抽取查询队伍列表方法
// const listTeam=async (val)=>{
//   const res=await myAxios.get("/team/list/my/join",{
//     params:{
//       searchText:val
//     }
//   })
//   if (res.code===0 && res.data){
//     teamList.value=res.data
//     console.log('查询成功')
//   }else {
//     console.log('查询失败')
//   }
// }

</script>

<style scoped>

</style>